<template>
  <div>
    <ZgEdit
      ref="dialog"
      :columns="columns"
      :formulas="formulas"
      :layout="layout"
      @ok="onOk"
      validUrl=""
      saveUrl="/zg-autoflow/autoFlow/main/add">
    </ZgEdit>
  </div>
</template>
<script>

const organizationArr = [
  { value: '1857327621547446273', label: '组织架构' },
  { value: '1857328762502991874', label: '新增节点' },
  { value: '1877276427550420994', label: '测试' },
  { value: '1877276504905969665', label: '新增节点' },
  { value: '1877276523021168642', label: '新增节点1' }

]
export default {
  props: {
    nextFlowData: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      layout: {
        '标签宽度': '140',
        '视图边距': 10,
        '标签对齐': 'right',
        '左右间距': 10,
        '上下间距': 10
      },
      columns: [
        { name: '流程名称', code: 'name', compType: '单行文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { maxLength: 30 } },
        { name: '归属单位', code: 'orgName', compType: '下拉选择', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 下拉选项: organizationArr } },
        // { name: '流程CODE', code: 'code', compType: '单行文本', isNeed: true, offset: 0, span: 24, defaultVal: '' },
        { name: '是否启用', code: 'isUse', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'flowIsConfig' } },
        { name: '流程类型', code: 'type', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'flowTranType' } },
        { name: '采集状态', code: 'state', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'flowState' } },
        { name: '后续流程', code: 'nextFlowCode', compType: '下拉选择', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 下拉选项: this.nextFlowData } },
        { name: '是否可以直接启动', code: 'canStart', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'flowIsConfig' } },
        { name: '流程分类', code: 'category', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'flowType' } }

      ],
      formulas: [
        { triggerMode: '初始化时', name: '公式1', content: 'console.log("init");' },
        { triggerMode: '数据变化时', name: '公式2', content: 'console.log("update");' },
        { triggerMode: '提交时', name: '公式3', content: 'console.log("submit");' }
      ]
    }
  },
  methods: {

    open () {
      this.$refs.dialog.open()
    },
    onOk () {
      this.$emit('ok')
    }
  }

}
</script>

<style lang="scss" scoped>
</style>
